package controller;

import pojo.Manage;
import service.ManageService;
import view.ManageDetails;
import view.ManageView;

import javax.swing.*;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

public class ManageClickListener implements MouseListener {
    private ManageView manageView;
    private JTable table;
    public ManageClickListener(ManageView dialog){
        this.manageView=dialog;
    }
    @Override
    public void mouseClicked(MouseEvent e) {
        int selRow = table.getSelectedRow();
        String lendTime = table.getValueAt(selRow,2).toString().trim();
        ManageService manageService = new ManageService();
        Manage manage =  manageService.searchLend(lendTime);
        ManageDetails manageDetails=new ManageDetails(manage,manageView);
    }

    @Override
    public void mousePressed(MouseEvent e) {

    }

    @Override
    public void mouseReleased(MouseEvent e) {

    }

    @Override
    public void mouseEntered(MouseEvent e) {

    }

    @Override
    public void mouseExited(MouseEvent e) {

    }

    public void setTable(JTable table) {
        this.table=table;
    }
}
